package com.example.devicemanage.dao;

import com.example.devicemanage.entity.Apply;
import com.example.devicemanage.entity.Equip;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ApplyMapper {

    @Select("SELECT * FROM apply")
    List<Apply> queryAllApply();

    @Update("UPDATE apply SET state= 1 WHERE aid=#{aid}")
    int passApply(int aid);

    @Delete("DELETE FROM apply WHERE aid=#{aid}")
    int deleteApply(int aid);

    @Insert("INSERT INTO apply(ename,category,model,spec,num,price,uname,state,date) VALUES(#{ename},#{category},#{model},#{spec},#{num},#{price},#{uname},'0','无')" )
    @Options(useGeneratedKeys = true, keyProperty = "aid", keyColumn = "aid")
    int saveApply(Apply apply);

    @Insert("INSERT INTO apply(aid,ename,category,model,spec,num,price,uname,state,date) VALUES(#{aid},#{ename},#{category},#{model},#{spec},#{num},#{price},#{uname},'0','无')" )
    int updateApply(Apply apply);
}
